package com.tedu.controller;

import com.tedu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    /**
     * 使用request获取
     */

    @RequestMapping("/parameter")
    @ResponseBody
    public String parameter(HttpServletRequest request) {
        return request.getParameter("name");
    }

    @RequestMapping("/para02")
    @ResponseBody
    public String para02(String name, String pwd) {
        String pam = "用户名" + name;
        String pw = "密码" + pwd;
        return pam + pw;
    }

    @RequestMapping("/login")
    @ResponseBody
    public String login(User user) {
        System.out.println(user);

        return user.toString();
    }

    @RequestMapping("/reg")
    @ResponseBody
    public String reg(User user){
        System.out.println("user");
        return user.toString();
    }

}
